package com.anolesoft.amljmes.fortyone.service.impl;

import com.anolesoft.amljmes.fortyone.dto.MesStoveQualityDto;
import com.anolesoft.amljmes.fortyone.service.MesStoveQualityService;
import com.anolesoft.amljmes.fortyone.service.mapper.MesStoveQualityServiceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MesStoveQualityServiceImpl implements MesStoveQualityService {
    @Autowired
    MesStoveQualityServiceMapper mesStoveQualityServiceMapper;

    //添加
    @Override
    public int addMesStoveQuality(MesStoveQualityDto inFoDtoParam) {
        String lcid = inFoDtoParam.getStoyeFabinfoObj();
        List<MesStoveQualityDto> list = mesStoveQualityServiceMapper.queryMesStoveQualityByCode(lcid);
        int count = 0;
        for(int i = 0;i<list.size();i++){
            MesStoveQualityDto a = list.get(i);
            String fortyone_code = a.getFortyoneCode();
            count = count + mesStoveQualityServiceMapper.addMesStoveQuality(inFoDtoParam);
        }
//        l count = mesStoveQualityServiceMapper.addMesStoveQuality(inFoDtoParam);
        return count;

    }

    //修改
    @Override
    public int updateMesStoveQuality(MesStoveQualityDto inFoDtoParam) {
        int count = mesStoveQualityServiceMapper.updateMesStoveQuality(inFoDtoParam);
        return count;
    }

    //根据炉次id查主键
    @Override
    public MesStoveQualityDto queryMesStoveQualityById(String stoyeFabinfoObj) {
        return mesStoveQualityServiceMapper.queryMesStoveQualityById(stoyeFabinfoObj);
    }

    // 根据炉次id查制造记录条码
    @Override
    public List<MesStoveQualityDto> queryMesStoveQualityByCode(String stoyeFabinfoObj) {
        return mesStoveQualityServiceMapper.queryMesStoveQualityByCode(stoyeFabinfoObj);
    }
}
